package com.travel.haoma.activity;

import android.content.Context;
import android.content.Intent;
import android.view.View;
import android.widget.EditText;

import com.travel.haoma.R;

import cn.haoma.base.common.BaseActivity;
import cn.haoma.base.common.Id;
import cn.haoma.base.common.LayoutId;

/**
 * Created by 磊 on 2015/9/4.
 */
@LayoutId(R.layout.act_feeling)
public class ActAddFeel  extends BaseActivity{
    public static Intent newIntent(Context context){
        return new Intent(context,ActAddFeel.class);
    }
    public static String processActivityResult(Intent intent){
        return intent.getStringExtra("feeling");
    }
    @Id(R.id.et_feeling)
    private EditText editText;
    @Override
    public void onClick(View view) {
        super.onClick(view);
        switch (view.getId()){
            case R.id.title_back:
                finish();
                break;
            case R.id.title_right:
                String str = editText.getText().toString().trim();
                if(str!=null){
                    if(str.length()>20){
                        showToast("请输入20字以内");
                    }
                    setResult(RESULT_OK,getIntent().putExtra("feeling",str));
                    finish();
                }else showToast("请输入心情");

                break;
        }
    }
}
